
import React from 'react';
import { Modal } from 'antd';
import ProForm, {  ProFormRadio } from '@ant-design/pro-form';
import emailUpdate from '../../funcs/email_update';

interface UpdateFormProps {
  modalVisible: boolean;
  userid:any;
  values:any;
  onCancel: () => void;
}

const UpdateForm: React.FC<UpdateFormProps> = (props) => {

  return (
    <Modal
      destroyOnClose
      title={"编辑邮箱"}
      visible={props.modalVisible}
      onCancel={() => props.onCancel()}
      onOk={() => props.onCancel()}
    >
      <ProForm
        initialValues={{
          is_active: props.values.is_active,
          is_delete: props.values.is_delete,
        }}
        onFinish={async (values) => {
          values["id"]=props.userid;
          emailUpdate(values);
        }}
      >
      <ProFormRadio.Group
            name="is_active"
            label="是否禁用"
            options={[
              {
                label: '禁用',
                value: false,
              },
              {
                label: '启用',
                value: true,
              },
            ]}
          />
      <ProFormRadio.Group
            name="is_delete"
            label="是否删除"
            options={[
              {
                label: '否',
                value: false,
              },
              {
                label: '是',
                value: true,
              },
            ]}
          />
      </ProForm>
    </Modal>
  );
};

export default UpdateForm;
